package kernel

import (
	"net/http"
)

func UseMiddleware(next http.HandlerFunc, ws ...MiddlewareFunc) http.HandlerFunc {
	for _, w := range ws {
		next = w(next)
	}
	return next
}

func MiddlewareFuncGroup(ws ...MiddlewareFunc) MiddlewareFunc {
	return func(hf http.HandlerFunc) http.HandlerFunc {
		return UseMiddleware(hf, ws...)
	}
}

// 中间件方法
type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc
